package com.zhouyiquan.reggie.common;

/**
 * @Author: 周益全 (https://gitee.com/zfovikqdev928)
 * @BugFeedBackEmail: zfovikqdev928@126.com
 * @Date: Create in 2022-10
 * @Description: 基于ThreadLocal封装的类，用于保存、获取当前登录的id
 * @Version: v1.0
 */
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     *
     * @return
     */
    public static Long getCurrentId() {
        return threadLocal.get(); //取出id
    }

    /**
     * 获取值
     *
     * @param id
     */
    public static void setCurrentId(Long id) {
        threadLocal.set(id); //保存id

    }
}
